#!/bin/sh
# get local IPv4 address of given network adapter otherwise 'down'

ip=$(ip addr show "${1}" \
	| sed -n '3s,    inet \(.*\)/.*,\1,p' \
)

printf '%s\n' "${ip:-down}"
